package com.cloudree.gllib.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.cloudree.gllib.R;
import com.cloudree.gllib.bean.FilterBean;
import com.kvin.toolkit.adapter.BasicAdapter;

import java.util.List;

/**
 * Created by Administrator on 2017/8/8.
 */
public class FilterAdapter extends BasicAdapter<FilterAdapter.ViewHolder, FilterBean> {

    public FilterAdapter(List<FilterBean> list, Context context) {
        super(list, context);
    }

    @Override
    protected View bindView(LayoutInflater inflater, ViewGroup viewGroup, Context context, List<FilterBean> list, int i) {
        return inflater.inflate(R.layout.adapter_filter, viewGroup, false);
    }

    @Override
    protected ViewHolder bindViewHolder(View view, ViewGroup viewGroup, Context context) {
        return new ViewHolder(view);
    }

    @Override
    protected void bindData(ViewHolder vh, int i, List<FilterBean> list, Context context) {
        vh.nameTv.setText(list.get(i).getName());
    }

    static class ViewHolder extends BasicAdapter.ViewHolder {
        TextView nameTv;

        public ViewHolder(View v) {
            super(v);
            this.nameTv = (TextView) v.findViewById(R.id.name_tv);
        }
    }
}
